//
//  HOStatisticsViewController.m
//  微度报修
//
//  Created by foguo-mac-1 on 7/20/16.
//  Copyright © 2016 WeiDu. All rights reserved.
//

#import "HOStatisticsViewController.h"
#import "HOUtils.h"
#import "HOConstants.h"
#import "HOStaticDataMgr.h"
#import "HODefine.h"

@interface HOStatisticsViewController ()
@property(nonatomic, retain)NSArray *statisticsTimes;
@property(nonatomic, retain)NSString *statisticsTime;
@property(nonatomic, retain)UIView 	*menuPanelView;
@property(nonatomic, retain)UIButton *oldBtn;
@property(nonatomic, assign)NSInteger selectedBtnTag;
@end

@implementation HOStatisticsViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
	[self initTableView];
	self.menuPanelView = [self createMenuItem];
//	[本年：yy;本月：mm;本周：ww;今天：today] String类型 必填)
	self.statisticsTimes = @[@"yy", @"mm", @"ww", @"today"];
	self.statisticsTime = [self.statisticsTimes firstObject];
}

- (void)viewWillAppear:(BOOL)animated
{
	[super viewWillAppear:animated];
	NSString *title = [HOUtils getStatisticsTitle:self.type];
	[self setNavigationItemTitle:title];
	[self requestData];
	[self displayRightButtonItemWithTitle:NSLocalizedString(@"更多", @"更多")];
	self.tabBarController.tabBar.hidden = YES;
}

- (void)requestData
{
	[self sendRequestWithParams:@{kHO_FIELD_Action:kHO_ACTION_DataStatistics,
								  @"StatisticsType":[NSNumber numberWithInt:self.type],
								  @"StatisticsTime":self.statisticsTime}];
}

- (void)hideKeyboard
{
	self.menuPanelView.hidden = YES;
}

- (void)rightButtonItemDidClick
{
	self.menuPanelView.hidden = !self.menuPanelView.hidden;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)displayAnalysis:(UIButton *)btn
{
	NSInteger tag = btn.tag;
	self.type = (HO_STATISTICS_TYPE)tag;
	NSString *title = [HOUtils getStatisticsTitle:self.type];
	[self setNavigationItemTitle:title];
	[self requestData];
	
}

- (UIView *)createMenuItem
{
	int number = 6;
	if([[[HOStaticDataMgr sharedInstance] getUserInfo] isLeaderUser])
	{
		number = 9;
	}
	UIView *view = [[[UIView alloc]
					 initWithFrame:CGRectMake(self.view.frame.size.width - 151,
											  0,
											  150,
											  number * 35)] autorelease];

	for(NSInteger i = 0; i < number; i++)
	{
		HO_STATISTICS_TYPE type = (HO_STATISTICS_TYPE)(i + 1);
		NSString *title = [HOUtils getStatisticsTitle:type];
		[view addSubview:[self createMenuItemWithTitle:title
										  withSelector:@selector(displayAnalysis:)
												 withY:i * 35
											   withTag:type]];
	}
	[view setBackgroundColor:[UIColor whiteColor]];
	view.layer.shadowOffset = CGSizeMake(0.0, 0.0); //shadow on the right and bottom sides.
	view.layer.shadowRadius = 4.0;
	view.layer.shadowOpacity = 0.25;
	[self.view addSubview:view];
	view.hidden = YES;
	return view;
}
- (UIButton *)createMenuItemWithTitle:(NSString *)title withSelector:(SEL)selector withY:(CGFloat)y withTag:(NSInteger)tag
{
	UIButton *btn = [UIButton buttonWithType:UIButtonTypeSystem];
	btn.frame = CGRectMake(- 1,
						   y,
						   152,
						   35);
	
	[btn setTitle:title forState:UIControlStateNormal];
	btn.layer.borderColor = UIColorFromRGB(0xcdcdcd).CGColor;
	btn.layer.borderWidth = [HOUtils defaultOnePixelConversion];
	[btn setTitleColor:TEXT_COLOR_666666 forState:UIControlStateNormal];
	btn.titleLabel.font = [UIFont systemFontOfSize:14];
	[btn addTarget:self action:selector forControlEvents:UIControlEventTouchUpInside];
	btn.tag = tag;
	return btn;
}


#pragma mark - -- UITableViewDelegate/UITableViewDataResource implement methods
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 44;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
	NSInteger count = [self.tableViewDataList count];
//	[self updateNoResultView:count];;
	return count + 1;
}

- (void)viewYearStatistics:(UIButton *)sender
{
	self.selectedBtnTag = 0;
	[self hightLightBtn:sender];
	self.statisticsTime = [self.statisticsTimes objectAtIndex:0];
	[self requestData];
}
- (void)viewMonthStatistics:(UIButton *)sender
{
	self.selectedBtnTag = 1;
	[self hightLightBtn:sender];
	self.statisticsTime = [self.statisticsTimes objectAtIndex:1];
	[self requestData];
}
- (void)viewWeekStatistics:(UIButton *)sender
{
	self.selectedBtnTag = 2;
	[self hightLightBtn:sender];
	self.statisticsTime = [self.statisticsTimes objectAtIndex:2];
	[self requestData];
}
- (void)viewDayStatistics:(UIButton *)sender
{
	self.selectedBtnTag = 3;
	[self hightLightBtn:sender];
	self.statisticsTime = [self.statisticsTimes objectAtIndex:3];
	[self requestData];
}

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
	UIView *view = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, baseTableview.frame.size.width, 50)] autorelease];
	CGFloat width = 4 * 70;
	CGFloat x = (baseTableview.frame.size.width - width) / 2;
	
	UIButton *btn1 = [self getButtonWithTitle:NSLocalizedString(@"本年", @"本年") withSel:@selector(viewYearStatistics:) withX:x];
	[view addSubview:btn1];
	btn1.tag = 0;
	
	UIButton *btn2 = [self getButtonWithTitle:NSLocalizedString(@"本月", @"本月") withSel:@selector(viewMonthStatistics:) withX:x + 70];
	[view addSubview:btn2];
	btn1.tag = 1;
	
	UIButton *btn3 = [self getButtonWithTitle:NSLocalizedString(@"本周", @"本周") withSel:@selector(viewWeekStatistics:) withX:x + 70 * 2];
	[view addSubview:btn3];
	btn1.tag = 2;
	
	UIButton *btn4 = [self getButtonWithTitle:NSLocalizedString(@"今天", @"今天") withSel:@selector(viewDayStatistics:) withX:x + 70 * 3];
	[view addSubview:btn4];
	btn1.tag = 3;
	UIButton *btn = nil;
	if(self.selectedBtnTag == 0)
	{
		btn = btn1;
	}
	else if(self.selectedBtnTag == 1)
	{
		btn = btn2;
	}
	else if(self.selectedBtnTag == 2)
	{
		btn = btn3;
	}
	else if(self.selectedBtnTag == 3)
	{
		btn = btn4;
	}
	[self hightLightBtn:btn];
	
	return view;
}

- (void)hightLightBtn:(UIButton *)btn
{
	if(self.oldBtn)
	{
		[self.oldBtn setBackgroundImage:[HOUtils createImageWithColor:[UIColor whiteColor] forView:btn] forState:UIControlStateNormal];
		[self.oldBtn setBackgroundImage:[HOUtils createImageWithColor:MAIN_COLOR_NORMAL forView:btn] forState:UIControlStateHighlighted];
		[self.oldBtn setBackgroundImage:[HOUtils createImageWithColor:MAIN_COLOR_NORMAL forView:btn] forState:UIControlStateSelected];
		[self.oldBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
	}
	
	[btn setBackgroundImage:[HOUtils createImageWithColor:MAIN_COLOR_NORMAL forView:btn] forState:UIControlStateNormal];
	[btn setBackgroundImage:[HOUtils createImageWithColor:[UIColor whiteColor] forView:btn] forState:UIControlStateHighlighted];
	[btn setBackgroundImage:[HOUtils createImageWithColor:[UIColor whiteColor] forView:btn] forState:UIControlStateSelected];
	[btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
	self.oldBtn = btn;
}

- (UIButton *)getButtonWithTitle:(NSString *)title withSel:(SEL)selector withX:(CGFloat)x
{
	UIButton *btn = [[[UIButton alloc] initWithFrame:CGRectMake(x,
															   10,
															   60,
															   30)] autorelease];
	[btn setTitle:title forState:UIControlStateNormal];
	btn.layer.cornerRadius = 5;
	btn.layer.borderWidth = [HOUtils defaultOnePixelConversion];
	btn.layer.borderColor = UIColorFromRGB(0xcdcdcd).CGColor;
	[btn.layer setMasksToBounds:YES];
	btn.titleLabel.font = [UIFont systemFontOfSize:14];
	[btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
	
	[btn addTarget:self action:selector forControlEvents:UIControlEventTouchUpInside];
	[btn setBackgroundImage:[HOUtils createImageWithColor:[UIColor whiteColor] forView:btn] forState:UIControlStateNormal];
	[btn setBackgroundImage:[HOUtils createImageWithColor:MAIN_COLOR_NORMAL forView:btn] forState:UIControlStateHighlighted];
	[btn setBackgroundImage:[HOUtils createImageWithColor:MAIN_COLOR_NORMAL forView:btn] forState:UIControlStateSelected];
	return btn;
}

- (CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 50;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    
}
#pragma mark
- (UIView *)getLineWithTag:(NSInteger)tag withCell:(UITableViewCell *)cell withX:(CGFloat)x withWidth:(CGFloat)width
{
	UIView *lineView = (UILabel *)[cell viewWithTag:tag];
	if(lineView == nil)
	{
		
		lineView = [[[UIView alloc]
					 initWithFrame:CGRectMake(x,
											  0,
											  1,
											  44)] autorelease];
		[lineView setBackgroundColor:UIColorFromRGB(0xcdcdcd)];
		[cell.contentView addSubview:lineView];
	}
	return lineView;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
	static NSString *AMBaseTableViewCellIdentifier = @"HOTableViewCell";
	UITableViewCell *cell = (UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:AMBaseTableViewCellIdentifier];
	if(cell == nil)
	{
		cell = [[[UITableViewCell alloc]
				 initWithStyle:UITableViewCellStyleDefault
				 reuseIdentifier: AMBaseTableViewCellIdentifier] autorelease];
	}
	CGFloat width = tableView.frame.size.width / 4;
	CGFloat cellHeight = [self tableView:tableView heightForRowAtIndexPath:indexPath];
	
	UILabel *titleLbl = (UILabel *)[cell viewWithTag:111];
	if(titleLbl == nil)
	{
		titleLbl = [[[UILabel alloc]
					initWithFrame:CGRectMake(0,
											 (cellHeight - 22) / 2,
											 width,
											 22)] autorelease];
		titleLbl.tag = 111;
		titleLbl.font = [UIFont systemFontOfSize:IS_IPHONE_5_SCREEN ? 13 : 15];
		titleLbl.textColor = TEXT_COLOR_666666;
		titleLbl.textAlignment = NSTextAlignmentCenter;
		[cell.contentView addSubview:titleLbl];
	}
	
	[self getLineWithTag:665 withCell:cell withX:width withWidth:width];
	[self getLineWithTag:666 withCell:cell withX:width * 2 withWidth:width];
	[self getLineWithTag:667 withCell:cell withX:width * 3 withWidth:width];
	
	
	UILabel *title1Lbl = (UILabel *)[cell viewWithTag:112];
	if(title1Lbl == nil)
	{
		title1Lbl = [[[UILabel alloc]
					 initWithFrame:CGRectMake(width,
											  (cellHeight - 22) / 2,
											  width,
											  22)] autorelease];
		title1Lbl.tag = 112;
		title1Lbl.font = [UIFont systemFontOfSize:IS_IPHONE_5_SCREEN ? 13 : 15];
		title1Lbl.textColor = TEXT_COLOR_666666;
		title1Lbl.textAlignment = NSTextAlignmentCenter;
		[cell.contentView addSubview:title1Lbl];
	}
	
	UILabel *title2Lbl = (UILabel *)[cell viewWithTag:113];
	if(title2Lbl == nil)
	{
		title2Lbl = [[[UILabel alloc]
					 initWithFrame:CGRectMake(width * 2,
											  (cellHeight - 22) / 2,
											  width,
											  22)] autorelease];
		title2Lbl.tag = 113;
		title2Lbl.font = [UIFont systemFontOfSize:IS_IPHONE_5_SCREEN ? 13 : 15];
		title2Lbl.textColor = TEXT_COLOR_666666;
		title2Lbl.textAlignment = NSTextAlignmentCenter;
		[cell.contentView addSubview:title2Lbl];
	}
	
	UILabel *title3Lbl = (UILabel *)[cell viewWithTag:114];
	if(title3Lbl == nil)
	{
		title3Lbl = [[[UILabel alloc]
					 initWithFrame:CGRectMake(width * 3,
											  (cellHeight - 22) / 2,
											  width,
											  22)] autorelease];
		title3Lbl.tag = 114;
		title3Lbl.font = [UIFont systemFontOfSize:IS_IPHONE_5_SCREEN ? 13 : 15];
		title3Lbl.textColor = TEXT_COLOR_666666;
		title3Lbl.textAlignment = NSTextAlignmentCenter;
		[cell.contentView addSubview:title3Lbl];
	}
	NSDictionary *dic = nil;
	if(indexPath.row > 0)
	{
		dic = [self.tableViewDataList objectAtIndex:(indexPath.row - 1)];
	}
	switch (self.type) {
  		case STATISTICS_TYPE_DEPT_WORKLOAD://1:维修部门维修量统计
		{
			//		 DepartmentName = "\U4fe1\U606f\U5904";
			//		 PaidNums = 1;
			//		 PayMoney = "10.00";
			//		 WorkNums = 1;
			if(indexPath.row == 0)
			{
				titleLbl.text = NSLocalizedString(@"维修单位", @"维修单位");
				title1Lbl.text = NSLocalizedString(@"维修量(次)", @"维修量(次)");
				title2Lbl.text = NSLocalizedString(@"有偿维修(次)", @"有偿维修(次)");
				title3Lbl.text = NSLocalizedString(@"维修费(元)", @"维修费(元)");
			}
			else
			{
				titleLbl.text = [HOUtils getValideString:[dic objectForKey:kHO_FIELD_DepartmentName]];
				title1Lbl.text = [NSString stringWithFormat:@"%d", [[dic objectForKey:kHO_FIELD_WorkNums] intValue]];
				title2Lbl.text = [NSString stringWithFormat:@"%d", [[dic objectForKey:kHO_FIELD_PaidNums] intValue]];
				title3Lbl.text = [NSString stringWithFormat:@"%0.2f", [[dic objectForKey:kHO_FIELD_PayMoney] floatValue]];
			}
		}
			break;
		case STATISTICS_TYPE_PERSONAL_WORKLOAD://2:个人维修量统计
		{
			//		 DepartmentName = "\U540e\U52e4\U5904";
			//		 DoneName = "\U7ef4\U4fee5";
			//		 PayMoney = "10.00";
			//		 WorkNums = 1;
			if(indexPath.row == 0)
			{
				titleLbl.text = NSLocalizedString(@"维修单位", @"维修单位");
				title1Lbl.text = NSLocalizedString(@"维修工", @"维修工");
				title2Lbl.text = NSLocalizedString(@"维修量(次)", @"维修量(次)");
				title3Lbl.text = NSLocalizedString(@"维修费(元)", @"维修费(元)");
			}
			else
			{
				titleLbl.text = [HOUtils getValideString:[dic objectForKey:kHO_FIELD_DepartmentName]];
				title1Lbl.text = [HOUtils getValideString:[dic objectForKey:kHO_FIELD_DoneName]];
				title2Lbl.text = [NSString stringWithFormat:@"%d", [[dic objectForKey:kHO_FIELD_WorkNums] intValue]];
				title3Lbl.text = [NSString stringWithFormat:@"%0.2f", [[dic objectForKey:kHO_FIELD_PayMoney] floatValue]];
			}
		}
			break;
		case STATISTICS_TYPE_FAULT_AREA://3:故障区域统计
		{
			
//				AreaId = 5;
//				AreaName = "\U95e8\U8bca1\U53f7\U697c\U4e00\U7ad9\U5f0f\U670d\U52a1\U53f0";
//				PaidNums = 0;
//				PayMoney = "0.00";
//				WorkNums = 1;
			if(indexPath.row == 0)
			{
				titleLbl.text = NSLocalizedString(@"故障区域", @"故障区域");
				title1Lbl.text = NSLocalizedString(@"维修量(次)", @"维修量(次)");
				title2Lbl.text = NSLocalizedString(@"有偿维修(次)", @"有偿维修(次)");
				title3Lbl.text = NSLocalizedString(@"维修费(元)", @"维修费(元)");
			}
			else
			{
				titleLbl.text = [HOUtils getValideString:[dic objectForKey:kHO_FIELD_AreaName]];
				title1Lbl.text = [NSString stringWithFormat:@"%d", [[dic objectForKey:kHO_FIELD_WorkNums] intValue]];
				title2Lbl.text = [NSString stringWithFormat:@"%d", [[dic objectForKey:kHO_FIELD_PaidNums] intValue]];
				title3Lbl.text = [NSString stringWithFormat:@"%0.2f", [[dic objectForKey:kHO_FIELD_PayMoney] floatValue]];
			}
		}
			break;
		case STATISTICS_TYPE_FAULT_TYPE://4:故障类型统计
		{
			//			FaultId = 11;
			//			FaultName = "\U5916\U5305";
			//			PaidNums = 0;
			//			PayMoney = "0.00";
			//			WorkNums = 1;
			if(indexPath.row == 0)
			{
				titleLbl.text = NSLocalizedString(@"故障类型", @"故障类型");
				title1Lbl.text = NSLocalizedString(@"维修量(次)", @"维修量(次)");
				title2Lbl.text = NSLocalizedString(@"有偿维修(次)", @"有偿维修(次)");
				title3Lbl.text = NSLocalizedString(@"维修费(元)", @"维修费(元)");
			}
			else
			{
				titleLbl.text = [HOUtils getValideString:[dic objectForKey:kHO_FIELD_FaultName]];
				title1Lbl.text = [NSString stringWithFormat:@"%d", [[dic objectForKey:kHO_FIELD_WorkNums] intValue]];
				title2Lbl.text = [NSString stringWithFormat:@"%d", [[dic objectForKey:kHO_FIELD_PaidNums] intValue]];
				title3Lbl.text = [NSString stringWithFormat:@"%0.2f", [[dic objectForKey:kHO_FIELD_PayMoney] floatValue]];
			}
		}
			break;
		case STATISTICS_TYPE_FAULT_DEPARTMENT://5:故障部门统计
		{
			//			FaultId = 11;
			//			FaultName = "\U5916\U5305";
			//			PaidNums = 0;
			//			PayMoney = "0.00";
			//			WorkNums = 1;
			if(indexPath.row == 0)
			{
				titleLbl.text = NSLocalizedString(@"故障部门", @"故障部门");
				title1Lbl.text = NSLocalizedString(@"维修量(次)", @"维修量(次)");
				title2Lbl.text = NSLocalizedString(@"有偿维修(次)", @"有偿维修(次)");
				title3Lbl.text = NSLocalizedString(@"维修费(元)", @"维修费(元)");
			}
			else
			{
				titleLbl.text = [HOUtils getValideString:[dic objectForKey:kHO_FIELD_DepartmentName]];
				title1Lbl.text = [NSString stringWithFormat:@"%d", [[dic objectForKey:kHO_FIELD_WorkNums] intValue]];
				title2Lbl.text = [NSString stringWithFormat:@"%d", [[dic objectForKey:kHO_FIELD_PaidNums] intValue]];
				title3Lbl.text = [NSString stringWithFormat:@"%0.2f", [[dic objectForKey:kHO_FIELD_PayMoney] floatValue]];
			}
		}
			break;
		case STATISTICS_TYPE_RESUBMIT://6:返修率统计
		{
//			DepartmentName = "\U540e\U52e4\U5904";
//			DoneName = "\U7ef4\U4fee5";
//			IsReSubmit = "100.00%";
//			WorkNums = 1;
			if(indexPath.row == 0)
			{
				titleLbl.text = NSLocalizedString(@"维修单位", @"维修单位");
				title1Lbl.text = NSLocalizedString(@"维修工", @"维修工");
				title2Lbl.text = NSLocalizedString(@"维修量(次)", @"维修量(次)");
				title3Lbl.text = NSLocalizedString(@"返修率", @"返修率");
			}
			else
			{
				titleLbl.text = [HOUtils getValideString:[dic objectForKey:kHO_FIELD_DepartmentName]];
				title1Lbl.text = [HOUtils getValideString:[dic objectForKey:kHO_FIELD_DoneName]];
				title2Lbl.text = [NSString stringWithFormat:@"%d", [[dic objectForKey:kHO_FIELD_WorkNums] intValue]];
				title3Lbl.text = [HOUtils getValideString:[dic objectForKey:@"IsReSubmit"]];
			}
		}
			break;
		case STATISTICS_TYPE_SATISFACTION://7:满意度统计
		{
//			CommentNums = 1;
//			DepartmentName = "\U540e\U52e4\U5904";
//			DoneName = "\U7ef4\U4fee3";
//			ScoreAvg = "0.00";
			if(indexPath.row == 0)
			{
				titleLbl.text = NSLocalizedString(@"维修单位", @"维修单位");
				title1Lbl.text = NSLocalizedString(@"维修工", @"维修工");
				title2Lbl.text = NSLocalizedString(@"评价次数(次)", @"评价次数(次)");
				title3Lbl.text = NSLocalizedString(@"平均评分", @"平均评分");
			}
			else
			{
				titleLbl.text = [HOUtils getValideString:[dic objectForKey:kHO_FIELD_DepartmentName]];
				title1Lbl.text = [HOUtils getValideString:[dic objectForKey:kHO_FIELD_DoneName]];
				title2Lbl.text = [NSString stringWithFormat:@"%d", [[dic objectForKey:@"CommentNums"] intValue]];
				title3Lbl.text = [HOUtils getValideString:[dic objectForKey:@"ScoreAvg"]];
			}
		}
			break;
		case STATISTICS_TYPE_REPAIR_EFFECT://8:维修效率统计
		{
//			AvgTime = 717;
//			DepartmentName = "\U540e\U52e4\U5904";
//			DoneName = "\U7ef4\U4fee5";
//			WorkNums = 1;
			if(indexPath.row == 0)
			{
				titleLbl.text = NSLocalizedString(@"维修单位", @"维修单位");
				title1Lbl.text = NSLocalizedString(@"维修工", @"维修工");
				title2Lbl.text = NSLocalizedString(@"维修次数(次)", @"维修次数(次)");
				title3Lbl.text = NSLocalizedString(@"平均用时(分)", @"平均用时(分)");
			}
			else
			{
				titleLbl.text = [HOUtils getValideString:[dic objectForKey:kHO_FIELD_DepartmentName]];
				title1Lbl.text = [HOUtils getValideString:[dic objectForKey:kHO_FIELD_DoneName]];
				title2Lbl.text = [NSString stringWithFormat:@"%d", [[dic objectForKey:@"WorkNums"] intValue]];
				title3Lbl.text = [NSString stringWithFormat:@"%d", [[dic objectForKey:@"AvgTime"] intValue]];
			}
		}
			break;
		case STATISTICS_TYPE_PERSONAL://9:个人得分统计
		{
//			DepartmentName = "\U540e\U52e4\U5904";
//			DoneId = 11;
//			DoneName = "\U7ef4\U4fee5";
//			GetScore = 0;
			//			PayMoney = "10.00";
			if(indexPath.row == 0)
			{
				titleLbl.text = NSLocalizedString(@"维修单位", @"维修单位");
				title1Lbl.text = NSLocalizedString(@"维修工", @"维修工");
				title2Lbl.text = NSLocalizedString(@"得分", @"得分");
				title3Lbl.text = NSLocalizedString(@"维修费(元)", @"维修费(元)");
			}
			else
			{
				titleLbl.text = [HOUtils getValideString:[dic objectForKey:kHO_FIELD_DepartmentName]];
				title1Lbl.text = [HOUtils getValideString:[dic objectForKey:kHO_FIELD_DoneName]];
				title2Lbl.text = [NSString stringWithFormat:@"%d", [[dic objectForKey:@"GetScore"] intValue]];
				title3Lbl.text = [HOUtils getValideString:[dic objectForKey:@"PayMoney"]];
			}
		}
			break;
			
  default:
			break;
	}
	
	return cell;
}
#pragma mark -- tool
- (void)dealloc
{
	self.menuPanelView = nil;
	self.statisticsTimes = nil;
	self.statisticsTime = nil;
	[super dealloc];
}

- (void)requestDidSuccessWithResponse:(HOBaseResponseEntity *)response
{
	if([response isEqualAction:kHO_ACTION_DataStatistics])
	{
		[self.tableViewDataList removeAllObjects];
		NSArray *array = [response.dataNode objectForKey:@"StatisticsData"];
		for(int i = 0; i < [array count]; i ++)
		{
			[self.tableViewDataList addObject:[array objectAtIndex:i]];
		}
		[baseTableview reloadData];
//		@"个人维修量统计"
//		/*
//		 DepartmentName = "\U4fe1\U606f\U5904";
//		 PaidNums = 1;
//		 PayMoney = "10.00";
//		 WorkNums = 1;
//		 */
//		@"个人维修量统计"
//		/*
//		 DepartmentName = "\U540e\U52e4\U5904";
//		 DoneName = "\U7ef4\U4fee5";
//		 PayMoney = "10.00";
//		 WorkNums = 1;
//		 */
//		@"故障区域"
//		/*
//		 
//		 AreaId = 5;
//		 AreaName = "\U95e8\U8bca1\U53f7\U697c\U4e00\U7ad9\U5f0f\U670d\U52a1\U53f0";
//		 PaidNums = 0;
//		 PayMoney = "0.00";
//		 WorkNums = 1;
//		 */
	}
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
